﻿using System.Collections.Generic;
using System.Net;

/*
 *  author: able
 *  @2012/2/21 12:14:01
 * 
 */
namespace __ts.Core.Api
{
    /// <summary>
    /// 
    /// </summary>
    public interface IoServer : IoService
    {
        /**
         * Returns a {@link Set} of the local addresses which are bound currently.
         */
        HashSet<SocketAddress> getLocalAddresses();

        /**
         * Binds to the specified local addresses and start to accept incoming
         * connections.
         *
         * @throws IOException
         *             if failed to bind
         */
        void bind(params SocketAddress[] localAddress);

        /**
         * Unbinds from all local addresses that this service is bound to and stops
         * to accept incoming connections. This method returns silently if no local
         * address is bound yet.
         * @throws IOException
         *             if failed to unbind
         */
        void unbindAll();

        /**
         * Unbinds from the specified local addresses and stop to accept incoming
         * connections. This method returns silently if the default local addresses
         * are not bound yet.
         * @throws IOException
         *             if failed to unbind
         */
        void unbind(params SocketAddress[] localAddress);
    }
}